package com.nightpiter.view.graphics.impl;

import android.graphics.Canvas;

import com.nightpiter.view.graphics.Paint;
import com.nightpiter.view.graphics.RectF;
import com.nightpiter.view.graphics.abstaractions.AbstractCanvas;

public class AndroidCanvas implements AbstractCanvas {

	public static com.nightpiter.view.graphics.Canvas wrap(Canvas canvas) {
		return new com.nightpiter.view.graphics.Canvas(
				new AndroidCanvas(canvas));
	}

	private Canvas canvas;

	public AndroidCanvas(Canvas canvas) {
		this.canvas = canvas;
	}

	public void drawArc(RectF oval, float startAngle, float sweepAngle,
			Paint paint) {
		canvas.drawArc(AndroidRectF.cast(oval), startAngle, sweepAngle,
				AndroidPaint.cast(paint));
	}

	public void drawCircle(float cx, float cy, float radius, Paint paint) {
		canvas.drawCircle(cx, cy, radius, AndroidPaint.cast(paint));
	}

	public void drawLine(float startX, float startY, float stopX, float stopY,
			Paint paint) {
		canvas.drawLine(startX, startY, stopX, stopY, AndroidPaint.cast(paint));
	}

	public void drawPoint(float x, float y, Paint paint) {
		canvas.drawPoint(x, y, AndroidPaint.cast(paint));
	}

	public void drawText(String text, float x, float y, Paint paint) {
		canvas.drawText(text, x, y, AndroidPaint.cast(paint));
	}

	public void scale(float sx, float sy) {
		canvas.scale(sx, sy);
	}

	public void translate(float dx, float dy) {
		canvas.translate(dx, dy);
	}

	public Canvas getCanvas() {
		return canvas;
	}

}
